y = [100000]

while y[-1]>0:
    for i in range(12):
        y.append(y[-1]*(1+0.004)-1000) #在集合y后添加y(n)
    for i in range(len(y)):
        print(f'第{i}个月末余额:{y[i]:.2f}元')

for i in range(len(y)):
    if i%12==0:
        print(f'第{i/12}年余额:{y[i]:.2f}元')


